load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "metautil",
    srcs = ["metafile.go"],
    importpath = "github.com/pingcap/tidb/br/pkg/metautil",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/errors",
        "//br/pkg/logutil",
        "//br/pkg/storage",
        "//br/pkg/summary",
        "//pkg/parser/model",
        "//pkg/statistics/handle/util",
        "//pkg/tablecodec",
        "//pkg/util/encrypt",
        "@com_github_docker_go_units//:go-units",
        "@com_github_gogo_protobuf//proto",
        "@com_github_opentracing_opentracing_go//:opentracing-go",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_pingcap_kvproto//pkg/encryptionpb",
        "@com_github_pingcap_log//:log",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "metautil_test",
    timeout = "short",
    srcs = [
        "main_test.go",
        "metafile_test.go",
    ],
    embed = [":metautil"],
    flaky = True,
    shard_count = 6,
    deps = [
        "//br/pkg/mock/storage",
        "//pkg/testkit/testsetup",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_pingcap_kvproto//pkg/encryptionpb",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
        "@org_uber_go_mock//gomock",
    ],
)
